home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre3.z / postgre3 / src / lib / H / rules / params.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  2.7 KB  |  87 lines

  1. /*
  2.  * params.h
  3.  * Declarations/definitions of stuff needed to handle parameterized plans.
  4.  *
  5.  * Identification:
  6.  *     $Header: /private/postgres/src/lib/H/rules/RCS/params.h,v 1.5 1991/01/17 18:57:41 sp Exp $
  7.  */
  8.  
  9. #ifndef ParamsIncluded
  10. #define ParamsIncluded    1    /* Include this file only once */
  11.  
  12. #include "tmp/postgres.h"
  13. #include "access/attnum.h"
  14.  
  15. /* ----------------------------------------------------------------
  16.  *
  17.  * The following are the possible values for the 'paramkind'
  18.  * field of a Param node.
  19.  *    
  20.  * PARAM_NAMED: The parameter has a name, i.e. something
  21.  *              like `$.salary' or `$.foobar'.
  22.  *              In this case field `paramname' must be a valid Name.
  23.  *              and field `paramid' must be == 0.
  24.  *
  25.  * PARAM_NUM:   The parameter has only a numeric identifier,
  26.  *              i.e. something like `$1', `$2' etc.
  27.  *              The number is contained in the `parmid' field.
  28.  *
  29.  * PARAM_NEW:   Used in PRS2 rule, similar to PARAM_NAMED.
  30.  *              The `paramname' & `paramid' refer to the "NEW" tuple
  31.  *        `paramname' is the attribute name and `paramid' its
  32.  *        attribute number.
  33.  *              
  34.  * PARAM_OLD:   Same as PARAM_NEW, but in this case we refer to
  35.  *        the "OLD" tuple.
  36.  */
  37.  
  38. #define PARAM_NAMED    11
  39. #define PARAM_NUM    12
  40. #define PARAM_NEW    13
  41. #define PARAM_OLD    14
  42. #define PARAM_INVALID   100
  43.  
  44.  
  45. /* ----------------------------------------------------------------
  46.  *    ParamListInfo
  47.  *
  48.  *    Information needed in order for the executor to handle
  49.  *    parameterized plans (you know,  $.salary, $.name etc. stuff...).
  50.  *
  51.  *    ParamListInfoData contains information needed when substituting a
  52.  *    Param node with a Const node.
  53.  *
  54.  *    kind   : the kind of parameter.
  55.  *      name   : the parameter name (valid if kind == PARAM_NAMED,
  56.  *               PARAM_NEW or PARAM_OLD)
  57.  *      id     : the parameter id (valid if kind == PARAM_NUM)
  58.  *         or the attrno (if kind == PARAM_NEW or PARAM_OLD)
  59.  *      type   : PG_TYPE OID of the value
  60.  *      length : length in bytes of the value
  61.  *      isnull : true if & only if the value is null (if true then
  62.  *               the fields 'length' and 'value' are undefined).
  63.  *      value  : the value that has to be substituted in the place
  64.  *               of the parameter.
  65.  *
  66.  *   ParamListInfo is to be used as an array of ParamListInfoData
  67.  *   records. An 'InvalidName' in the name field of such a record
  68.  *   indicates that this is the last record in the array.
  69.  *
  70.  * ----------------------------------------------------------------
  71.  */
  72.  
  73. typedef struct ParamListInfoData {
  74.     int            kind;
  75.     Name        name;
  76.     AttributeNumber    id;
  77.     ObjectId        type;
  78.     Size        length;
  79.     bool        isnull;
  80.     bool        byval;
  81.     Datum        value;
  82. } ParamListInfoData;
  83.  
  84. typedef ParamListInfoData *ParamListInfo;
  85.  
  86. #endif
  87.